import Agent from '@/modules/Agent';
import Widget from '../Widget';
import { createRoot } from 'react-dom/client';
import React from 'react';
import ReactDOM from 'react-dom';




const render = () => {
	if (Agent.rootContainer) {
		const root = createRoot(Agent.rootContainer); // createRoot(container!) if you use TypeScript
		root.render(<Widget></Widget>);
	}
};

const destroy = () => {
	if (Agent.rootContainer) {
		ReactDOM.unmountComponentAtNode(Agent.rootContainer);
	}
};

const AgentServer = {
	Agent,
	render,
	destroy
};

export default AgentServer;
